<h1>freemarker数据类型</h1>
<#--
布尔类型：在freemark中不能直接输出
        方式一：flag?c
        方式二: flag?string
                flag?string("true的文本","false的文本")
        方式三：flag?then("yes","no")

-->
<h5>布尔类型</h5>
${flag?c}  <br>
${flag?string}  <br>
${flag?string("yes","no")}  <br>
${flag?then("like","not like")}  <br>
<br>
<hr>

<h5>日期类型</h5>
${createTime?date}  <br>
${createTime?time}  <br>
${createTime?datetime}  <br>
${createTime?string("yyyy/MM/dd HH:mm:ss")}  <br>
<br>
<hr>

<h5>数值类型</h5>
${age}  <br>
${salary}  <br>
<#--转换成字符串，去掉分隔符-->
${salary?c}  <br>
<#--转换成货币-->
${salary?string.currency}  <br>
<#--转换成百分比-->
${salary?string.percent}  <br>
${avg}  <br>
<#--将浮点型转换成指定小数位数输出-->
${avg?string["0.##"]}  <br>
<br>
<hr>


<h5>字符串类型</h5>
${msg}--${msg2}  <br>
<#--字符串截取 左闭右开-->
${msg?substring(2)} <br>
<#--转换大小写-->
${msg?cap_first} <br>
${msg2?uncap_first} <br>
${msg?lower_case} <br>
${msg2?upper_case} <br>
<#--获取指定索引-->
${msg?index_of("l")}
<br>
<h5>字符串空值情况处理</h5>
<#--字符串空值情况处理:如果没有值会报错-->
<#--FreeMarker template error (DEBUG mode; use RETHROW in production!): The following has evaluated to null or missing: ==> msg3 -->
<#--${msg3}  <br>-->
<#--字符串为null或者没有都报错-->
<#--数据为空，则为空字符串-->
${msg3!}  <br>
<#--为空，则显示默认值-->
${msg3!"msg3的数据不存在"}  <br>
<#--?? 判断值是否存在-->
${(msg3??)?string}  <br>
<br>

<hr>
<h5>序列类型</h5>
<#--数组-->
<#list strArr as str >
    ${str}--- ${str?index} <br>
</#list>
<br>
<#--list-->
<#list strList?sort as str >
    ${str}--- ${str?index} <br>
</#list>
<br>
<#--javabean-->
<#list users as user >
    姓名：${user.name}---年龄： ${user.age} <br>
</#list>
<br>
<#--排序-->
<#list users?sort_by("age") as user >
    姓名：${user.name}---年龄： ${user.age} <br>
</#list>
<br>
<hr>


<h5>hash类型</h5>
<#--按key遍历输出-->
<#list citys?keys  as key >
    ${key} --- ${citys[key]} <br>
</#list>
<br>
<#--按value遍历输出-->
<#list citys?values as value >
    ${value}<br>
</#list>
<br>
<hr>


